#ifndef __INT_SN65HVD_H__
#define __INT_SN65HVD_H__

#include "stm32f10x.h"
#include "Com_Delay.h"
#include "Com_Debug.h"

// CAN波特率定义
#define CAN_BAUDRATE_1M 0
#define CAN_BAUDRATE_500K 1
#define CAN_BAUDRATE_250K 2
#define CAN_BAUDRATE_125K 3

// CAN消息结构体
typedef struct
{
    uint32_t StdId;  // 标准ID
    uint32_t ExtId;  // 扩展ID
    uint8_t IDE;     // ID类型 (0=标准, 1=扩展)
    uint8_t RTR;     // 帧类型 (0=数据帧, 1=远程帧)
    uint8_t DLC;     // 数据长度
    uint8_t Data[8]; // 数据
} CAN_Message_t;

// 函数声明
void CAN_Driver_Init(uint8_t baudrate);
uint8_t CAN_Send_Message(CAN_Message_t *msg);
uint8_t CAN_Receive_Message(CAN_Message_t *msg);
void CAN_Filter_Config(void);

void Simple_LoopBack_Test(void);

void can_extended_frame_test(void);

#endif
